/* Popovers/Menus */

//.the popover itself
.popup-menu-boxpointer {
  -arrow-border-radius: 6px;
  -arrow-background-color: transparent;
  -arrow-border-width: 0;
  -arrow-border-color: transparent;
  -arrow-base: 22px;
  -arrow-rise: 0;
  -arrow-box-shadow: none; //dreaming. bug #689995
  background: transparent; // needs to reset?
}

// container of the popover menu
.popup-menu {
  min-width: 12em;
  color: $fg_color;
  font-weight: normal;
  padding: 0 !important;
  margin: 6px;
  background: none !important;
  border: none !important;
  box-shadow: 0 3px 5px rgba(black, 0.06);
  border-radius: $mn_radius + $base_padding * 2;
  @include font(body-1);

  .popup-menu-content {
    font-weight: normal;
    border: 1px solid if($variant == 'light', $borders_color, black);
    box-shadow: inset 0 0 0 1px rgba(white, 0.1);
    padding: $mn_radius * 1.5 0;
    margin: 0;
    border-radius: $mn_radius * 1.5;
    background-color: $menu_bg;
  }

  .popup-menu-item {
    spacing: 12px;
    padding: 6px;
    border-radius: 0 !important;
    color: $alt_fg_color !important;
    text-shadow: none;
    font-weight: normal;
    transition-duration: 0 !important;
    background-color: transparent !important;

    &:checked {
      font-weight: normal;
      background-color: $selected_bg_color !important;
      color: $light_fg_color !important;
      box-shadow: none;

      &:hover, &:focus, &.selected {
        color: $light_fg_color !important;
        background-color: lighten($selected_bg_color, 5%) !important;
        box-shadow: none;
      }

      &:active {
        color: $light_fg_color !important;
        background-color: darken($selected_bg_color, 5%) !important;
        box-shadow: none;
      }

      &:insensitive { color: $light_disabled_fg_color !important; }
    }

    &:hover, &:focus, &.selected {
      color: $light_alt_fg_color !important;
      background-color: $selected_bg_color !important;
      box-shadow: none;
      transition-duration: 0 !important;
    }

    &:active, &.selected:active {
      color: $light_fg_color !important;
      background-color: darken($selected_bg_color, 5%) !important;
      box-shadow: none;
    }

    &:insensitive { color: $disabled_fg_color !important; }
  }

  .popup-sub-menu {
    background-color: rgba(black, if($variant == 'light', 0.08, 0.15)) !important;
    box-shadow: none;
    border-radius: 0 !important;
    border-top: 1px solid rgba(black, if($variant == 'light', 0.15, 0.75)) !important;
    border-bottom: 1px solid rgba(black, if($variant == 'light', 0.15, 0.75)) !important;
    border-left: none !important;
    border-right: none !important;

    .popup-menu-ornament {
      min-width: $base_icon_size !important;
    }
  
    // submenu specific styles
    .popup-menu-item {
      border-radius: 0;
      border-top-width: 0;
      color: $alt_fg_color !important;
      text-shadow: none;
      font-weight: normal;
      background-color: transparent !important;

      &:hover, &:focus, &.selected {
        color: $light_alt_fg_color !important;
        background-color: $selected_bg_color !important;;
      }
  
      &:active, &.selected:active {
        color: $light_fg_color !important;
        background-color: darken($selected_bg_color, 5%) !important;
      }

      &:last-child {
        border-radius: 0;
        border-bottom-width:0;
      }
    }
  
    .popup-menu-section {
      .popup-menu-item:last-child {
        &:hover,&:focus { border-radius: 0;}
      }
      &:last-child .popup-menu-item:last-child {
        border-radius: 0;
      }
    }
  }

  .popup-inactive-menu-item { //all icons and other graphical elements
    color: $alt_fg_color !important;

    &:insensitive { color: $disabled_fg_color !important; }
  }

  //.popup-status-menu-item { font-weight: normal;  color: pink; } //dunno what that is
  &.panel-menu {
    -boxpointer-gap: $base_margin; // distance from the panel
    margin-bottom: 1.75em;
  }

  StEntry {
    selection-background-color: $light_alt_fg_color;
    selected-background-color: $light_alt_fg_color;
    selected-color: $primary_color;
    caret-color: $fg_color;

    StLabel.hint-text {
      margin-left: 2px;
      color: transparentize($fg_color, 0.3);
    }
  }

  .search-entry {
    @extend %entry;
    border-radius: $circular_radius;
  }
}
// symbolic icons in popover
.popup-menu-arrow,
.popup-menu-icon {
  icon-size: $base_icon_size;
  margin: 0 !important;
}

// container for radio and check boxes
.popup-menu-ornament {
  width: 1.2em;

  &:ltr { text-align: right };
  &:rtl { text-align: left };
}

// separator
.popup-separator-menu-item {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  background: none;
  border: none;

  .popup-separator-menu-item-separator {
    height: 1px; //not really the whole box
    margin: 0 40px !important;
    background-color: $borders_color;
    padding: 0 !important;

    .popup-sub-menu & { //submenu separators
      padding: 0 !important;
      margin: 0 58px 0 24px !important;
    }
  }
}

// desktop background menu
.background-menu {
  -boxpointer-gap: $base_margin;
  -arrow-rise: 0px; // hide the beak on the menu
}

// system status popover menu
.aggregate-menu {
  min-width: 21em;

  // lock screen, shutdown, etc. buttons
  .popup-menu-icon {
    padding: 0;
    margin: 0;
    -st-icon-style: symbolic;
  }
}
